﻿#pragma once


#include "select.h"

namespace Den{

//------------------не существующий тип данных. нет даже void--------------//
struct SEmpty;
//------------------------------------------------------------------------//


//---------- выберет тип с максимальным sizeof
template<class T1, class T2, class T3=SEmpty, class T4=SEmpty, class T5=SEmpty, class T6=SEmpty, class T7=SEmpty, class T8=SEmpty, class T9=SEmpty, class T10=SEmpty>
struct SelectMax
{
	typedef typename SelectMax< typename SelectMax<T1,T2,T3,T4,T5,T6,T7,T8,T9>::Result ,T10>::Result Result;
	enum { eSIZE = sizeof(Result) };
};
template<class T1, class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9>struct SelectMax<T1,T2,T3,T4,T5,T6,T7,T8,T9,SEmpty>
{
	typedef typename SelectMax< typename SelectMax<T1,T2,T3,T4,T5,T6,T7,T8>::Result ,T9>::Result Result;
	enum { eSIZE = sizeof(Result) };
};
template<class T1, class T2,class T3,class T4,class T5,class T6,class T7,class T8>struct SelectMax<T1,T2,T3,T4,T5,T6,T7,T8,SEmpty,SEmpty>
{
	typedef typename SelectMax< typename SelectMax<T1,T2,T3,T4,T5,T6,T7>::Result ,T8>::Result Result;
	enum { eSIZE = sizeof(Result) };
};
template<class T1, class T2,class T3,class T4,class T5,class T6,class T7>struct SelectMax<T1,T2,T3,T4,T5,T6,T7,SEmpty,SEmpty,SEmpty>
{
	typedef typename SelectMax< typename SelectMax<T1,T2,T3,T4,T5,T6>::Result ,T7>::Result Result;
	enum { eSIZE = sizeof(Result) };
};
template<class T1, class T2,class T3,class T4,class T5,class T6>struct SelectMax<T1,T2,T3,T4,T5,T6,SEmpty,SEmpty,SEmpty,SEmpty>
{
	typedef typename SelectMax< typename SelectMax<T1,T2,T3,T4,T5>::Result ,T6>::Result Result;
	enum { eSIZE = sizeof(Result) };
};
template<class T1, class T2,class T3,class T4,class T5>struct SelectMax<T1,T2,T3,T4,T5,SEmpty,SEmpty,SEmpty,SEmpty,SEmpty>
{
	typedef typename SelectMax< typename SelectMax<T1,T2,T3,T4>::Result ,T5>::Result Result;
	enum { eSIZE = sizeof(Result) };
};
template<class T1, class T2,class T3,class T4>struct SelectMax<T1,T2,T3,T4,SEmpty,SEmpty,SEmpty,SEmpty,SEmpty,SEmpty>
{
	typedef typename SelectMax< typename SelectMax<T1,T2,T3>::Result ,T4>::Result Result;
	enum { eSIZE = sizeof(Result) };
};
template<class T1, class T2,class T3>struct SelectMax<T1,T2,T3,SEmpty,SEmpty,SEmpty,SEmpty,SEmpty,SEmpty,SEmpty>
{
	typedef typename SelectMax< typename SelectMax<T1,T2>::Result ,T3>::Result Result;
	enum { eSIZE = sizeof(Result) };
};
template<class T1, class T2>struct SelectMax<T1,T2,SEmpty,SEmpty,SEmpty,SEmpty,SEmpty,SEmpty,SEmpty,SEmpty>
{
	enum { eFIRST_IF_TRUE = sizeof(T1)>sizeof(T2) };
	typedef typename Select<eFIRST_IF_TRUE,T1,T2>::Result Result;
	enum { eSIZE = sizeof(Result) };
};

}//namespace Den